package com.mahjong.server.component.logic.manager;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.Logger;

/**
 * 缓存管理
 * @user:   Administrator
 * @author： 游刚
 * @version：1.0
 * @created：Apr 10, 2013
 */

public class CacheListener implements ServletContextListener{
	
	private Logger log = Logger.getLogger(CacheListener.class);

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		log.info("-----初始化：加载缓存-----");
		try {
			//加载剩余麻将,初始化时为整副,发牌、和游戏过程中会慢慢减少
			//CacheManager.setCache(LogicConstant.Left_MAHJONG_1, LogicConstant.allPai1);
			//CacheManager.setCache(LogicConstant.Left_MAHJONG_2, LogicConstant.allPai2);
		} catch (RuntimeException e) {
			e.printStackTrace();
		}
	}
	
}
